package com.zjljr.oshiapp.common;

import lombok.Data;

@Data
public class R {
    private Integer code;
    private String msg;
    private Object data;

    public R(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public R(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    //成功，ok
    public static R ok(){
        return new R(200,"success");
    }
    //成功，ok
    public static R ok(Object data){
        return new R(200,"success", data);
    }
    //失败error
    public static R error(){
        return new R(500,"error");
    }
    //失败error
    public static R error(Object data){
        return new R(500,"error",data);
    }

}
